<%@page import="java.util.Vector"%>
<%@page import="status.Status"%>
<%@page import="status.StatusVo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>게시판 목록</title>
 <script>
 function getId(id) {return document.getElementById(id);}
 function goPage(page){
		var ff = document.search_form;
		ff.nowPage.value = page;
	    ff.action = "index.jsp?inc_contents=./status/status.jsp";
		ff.submit();
	}
 if(getId('btnFind') != null){
		getId('btnFind').onclick = function(){
			search_form.action = url +"list.jsp";
			search_form.submit();
		}
	} 
 
 </script>
 
    <!-- CSS 영역 -->
    <style type="text/css">
        @import url(http://fonts.googleapis.com/earlyaccess/hanna.css); /* "Hanna" */
        @import url(http://fonts.googleapis.com/earlyaccess/jejugothic.css); /* "Jeju Gothic" */
        @import url(http://fonts.googleapis.com/earlyaccess/jejuhallasan.css); /* "Jeju Hallasan" */
        @import url(http://fonts.googleapis.com/earlyaccess/jejumyeongjo.css); /* "Jeju Myeongjo" */
        @import url(http://fonts.googleapis.com/earlyaccess/kopubbatang.css); /* "KoPub Batang" */
        p {width: 600px; text-align: right;}
        table thead tr th {background-color: #faa719;}
        table caption {font-size: 40px; color:#0fce84;}
        .ting{
              height :30px;
              font-size: 18px;  
              font-family: "KoPub Batang";
              padding-top: 5px;
         }
         a{
              text-decoration: none;
         }
         a:link{
         color:black;
         }
         a:hover{
         color:#0fce84;
         }
#gul{
text-align: center;
width: 663px;
height : 100px;
font-size:x-large;
color : #0fce84;
}         
#su{
float:left;
margin-top:2px;
margin-left:1px;
width: 820px;
}         
#mm{
text-align:center;       
width: 840px;
height:10px; 
}
#serial1{
border : 1px solid #aaaaaa;
background-color: #faa719;
margin-top:1px;
margin-left:1px;
float:left;
width: 50px;
position: relative;
}
#company1{
border : 1px solid #aaaaaa;
background-color: #faa719;
margin-top:1px;
margin-left:1px;
float:left;
width: 170px;
position: relative;
}
#subject1{
border : 1px solid #aaaaaa;
background-color: #faa719;
margin-top:1px;
margin-left:1px;
width: 300px;
float:left;
}
#mid1{
border : 1px solid #aaaaaa;
 background-color: #faa719;
margin-top:1px;
margin-left:1px;
 width:80px;
float:left;
}
#date1{
border : 1px solid #aaaaaa;
 background-color: #faa719;
margin-top:1px;
margin-left:1px;
width:105px;
float:left;
}
#hit1{
border : 1px solid #aaaaaa;
 background-color: #faa719;
margin-top:1px;
margin-left:1px;
width:70px;
float:left;
}
#serial2{
border : 1px solid #aaaaaa;
margin-top:1px;
margin-left:1px;
float:left;
width: 50px;
position: relative;
}
#company2{
border : 1px solid #aaaaaa;
margin-top:1px;
margin-left:1px;
float:left;
width: 170px;
position: relative;
}
#subject2{
border : 1px solid #aaaaaa;
margin-top:1px;
margin-left:1px;
 width: 300px;
 float:left;
 
}
#mid2{
border : 1px solid #aaaaaa;
margin-top:1px;
margin-left:1px;
 width:80px;
float:left;
}
#date2{
border : 1px solid #aaaaaa;
margin-top:1px;
margin-left:1px;
width:105px;
float:left;
white-space: nowrap;
overflow:hidden;
}
#hit2{
border : 1px solid #aaaaaa;
margin-top:1px;
margin-left:1px;
width:70px;
float:left;
}
#main{
margin-top:1px;
margin-left:1px;
   width:1000px;
   height:100%;
   
}
#contents{
   width:1000px;
   height:720px;
   margin-left:100px;
   margin-top:100px;
}  
      
    </style>
    </head>
    <body>
<jsp:useBean id="vo" class='status.StatusVo'></jsp:useBean>
<jsp:setProperty property="*" name="vo"/>
<% 
//아이디 정보 가져오는 것(로그인 확인하는 것)
String sessionID=(String)session.getAttribute("mid");
if(sessionID==null) sessionID="notUser";
%>
<%


//검색어 세션처리
if(request.getMethod().equals("POST")){
	session.setAttribute("find", vo.getFind());
}else{
 if((String)session.getAttribute("find") != null){
	 vo.setFind((String)session.getAttribute("find"));
 }  
}

//페이지 정보유지
if(request.getParameter("nowPage")==null){
	if(session.getAttribute("nowPage") !=null)
		vo.setNowPage((Integer)session.getAttribute("nowPage"));
}else{
	session.setAttribute("nowPage", vo.getNowPage());
}



%>
<%
	Status g = new Status();
g.setVo(vo);
g.setNowPage(vo.getNowPage());
Vector<StatusVo> v = g.list();
%>
       <%
           	//컨텐트에 넣기
           String inc_contents = request.getParameter("inc_contents");
           if(inc_contents == null || inc_contents == "") inc_contents = "status.jsp";
           %>
       <div id='main'>
       <div id='contents'>
       <!-- 검색 폼 영역 -->
           <form name='search_form' action="" method="post" >
           <input style='font-size: 20px; width: 200px; ' type="search" name="find" id='find' value="<%=vo.getFind()%>" />
           <input style='font-size: 20px; ' type="submit" value="검색"/>
           <input type='hidden' name='nowPage' value='<%=g.getNowPage()%>'>
           </form>
       
       
       <!-- 게시판 목록 영역 -->
          <div id='gul'>
           <h1 style='font-family: "Hanna"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;취업 현황<p/></h1>
           </div>
           
           
           
               <div id='mm' class='ting'>
                    <div id='serial1' class='ting'>번호</div>
                    <div id='company1' class='ting'>회사</div>
                    <div id='subject1' class='ting'>제목</div>
                    <div id='mid1' class='ting' >작성자</div>
                    <div id='date1' class='ting'>등록 일시</div>
                    <div id='hit1' class='ting'>조회수</div>
               </div>
<%
               	for(int i=0;i<v.size();i++){
                  StatusVo gv = v.get(i);
               %>	   
           
              
               <div id='mm' class='ting'>
                    <div id='serial2' class='ting' align="center"><%=gv.getSerial()%></div>
                    <div id='company2' class='ting' align='center'><%=gv.getCompany()%></div>
                    <div id='subject2' class='ting' ><a href='index.jsp?inc_contents=./status/view.jsp&serial=<%=gv.getSerial()%>'><%=gv.getSubject()%></a></div>
                    <div id='mid2' class='ting' align="center"><%=gv.getMid()%></div>
                     <div id='date2' class='ting' align="center"> <%=gv.getMdate()%></div>
                     <div id='hit2' class='ting' align='center'><%=gv.getHit()%></div>
     			</div>
  <%} %>       
  <br/><p/>
               <div>
               
                    <div id='su'>
                     <center><%if(g.getNowBlock()>1){ %>
                    <input  type='button' value='맨처음' onclick='goPage(1)'>
                    <input  type='button' value='이전'  onclick='goPage(<%=g.getStartPage()-1%>)'>
                 <% } %>
                    [
                    <%for(int p=g.getStartPage();p<=g.getEndPage();p++){ %>
                    <input type='button' value='<%=p %>' onclick='goPage(<%=p%>)'>
               <% } %>
                    ]
                    <% if(g.getNowBlock() < g.getTotBlock()){ %>
                    <input type='button' value='다음' onclick='goPage(<%=g.getEndPage()+1%>)'>
                 <input  type='button' value='맨끝' onclick='goPage(<%=g.getTotPage()%>)'>
                 <%} %></center>
                    <br/>
                    <center><a href='index.jsp?inc_contents=./jobtc.jsp'><input style='font-size: 20px;'  type="button" value="MainPage" ></a> 
         			  <%if(sessionID.equals("admin")){ %>
         			  <a href='index.jsp?inc_contents=./status/status_wr.jsp'><input style='font-size: 20px;'  type="button" value="글쓰기" id='write'></a></center>
                      <%} %>  
                 </div>
                    
           
               </div>
               
       <!-- 버튼 영역 -->
      　　　　　　　　　　　　　　　　　　　　　　　　<br/>

           
          
          
          </div>
       </div>
     
    </body>
    </html>

    
  

